// +----------------------------------------------------------------------
// | CodeEngine
// +----------------------------------------------------------------------
// | Copyright 艾邦
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: TaoGe <liangtao.gz@foxmail.com>
// +----------------------------------------------------------------------
// | Version: 2.0 2019/7/11 15:22
// +----------------------------------------------------------------------
'use strict';

/**
 * 缓存类
 */
class Cache {

	cache = {};

	static getInstance() {
		if ( !this.instance ) {
			this.instance = new Cache();
		}
		return this.instance;
	}

	get( key ) {
		return this.cache[ key ];
	}

	set( key, value ) {
		this.cache[ key ] = value;
	}

	del( key ) {
		delete this.cache[ key ];
	}

	clear() {
		this.cache = {};
	}

	getAll() {
		return this.cache;
	}

}

export default Cache.getInstance();
